<?php include $this->getViewFile('/common/Head') ?>
<body class="J_scroll_fixed">

  <div class="wrap J_check_wrap">
    <?php include $this->getViewFile('/common/Nav') ?>

     <!-- 搜索 -->
    <div class="h_a">查找</div>
    <?php $objForm = $this->beginWidget( 'CActiveForm', array('id' => 'searchForm','method' => 'get', 'action' => $this->createUrl('index')) ); ?>
      <div class="search_type cc mb10">
           <div class="mb10">
            关键字：
            <?php echo Form::select(array(1=>'用户名',2=>'用户UID'),$formData['type'],'name="type"') ?>
            <input type="text" class="input length_2" id="keyword" name="keyword" style="width:200px;" value="<?php echo $formData['keyword'] ?>" placeholder="请输入搜索内容...">
            &nbsp;&nbsp;&nbsp;&nbsp;
            状态：<?php echo $objForm->dropDownList($model,'status',MembersTransfer::getStatusHtmlList(),array('empty' => '全部')); ?>&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn">搜索</button>
          </div>
      </div>
    <?php $this->endWidget(); ?>


    <!-- 列表 -->
    <div class="mb10"> 共有 ( <b><?php echo $count; ?></b> ) 条记录</div>
    <form name="myform" action="" method="post" class="J_ajaxForm">
      <div class="table_list">
        <table width="100%" cellspacing="0">
          <thead>
            <tr>
              <td align="center">会员ID</td>
              <td align="center">用户名</td>
              <td align="center">电话</td>
              <td align="center">支付宝账号</td>
              <td align="center">支付宝姓名</td>
              <td align="center">旺旺号</td>
              <td align="center">提交时间</td>
              <td align="center">原因</td>
              <td align="center">处理状态</td>
              <td align="center">操作</td>
            </tr>
          </thead>
          <tbody>

             <?php foreach($models as $rs){ ?>
             <tr>
                <td width="50" align="center"><?php echo $rs->uid?></td>
                <td align="center"><?php echo $rs->username; ?></td>
                <td align="center"><?php echo $rs->phone?></td>
                <td align="center"><?php echo CHtml::decode($rs->alipay)?></td>
                <td align="center"><?php echo CHtml::decode($rs->alipay_name)?></td>
                <td align="center"><?php echo CHtml::decode($rs->taobao_user_nick)?></td>
                <td align="center"><?php echo date('Y-m-d H:i',$rs->update_time)?></td>
                <td align="center"><?php echo $rs->cause?></td>
                <td id="status_<?php echo $rs->uid ?>" align="center"><?php echo MembersTransfer::getStatusHtmlDetail($rs->status)?></td>
                <td id="oper_<?php echo $rs->uid ?>" align="center">
                <?php if($rs->status == 0){
                  if(RBAC::authenticate('editStatus')){
                    $op = array();
                    $op[] = '<a class="J_ajax_del" data-msg="确定转换为商家吗" href="'.AdminBase::U("editStatus",array('uid'=>$rs->uid, 'status' => 1)).'" >同意</a>';
                    $op[] = '<a class="J_ajax_notice"  href="javascript:void(0);" data-uid="'.$rs->uid.'"  >拒绝</a>';
                    $op = implode(' | ', $op);
                    echo $op;
                  }                    
                } 
                ?>
                </td>
            
              </tr>
             <?php } ?>

          </tbody>
        </table>

        <!-- 分页 -->
        <div class="p10">
          <div class="pages"><?php echo $pages;?></div>
        </div>
        
      </div>
    </form>


  </div>
  <script src="<?php echo $staticUrl; ?>statics/js/common.js"></script>

  <script type="text/javascript">
    $(function(){
    $(".J_ajax_notice").click(function(){
      var obj = $(this);
      var uid = obj.data('uid');
      var status = 2;
      var url = "<?php echo $this->createUrl('editStatus') ?>";
      Wind.use('artDialog','iframeTools', function () {
        var dialog = art.dialog({
          title: '信息通知',
          id: 'notice',
          lock: true,
          fixed: true,
          width:600,
          height:70,
          background: "#CCCCCC",
          padding:'5px 5px',
          opacity: 0,
          button:[{
            name:'确定',
            callback:function(){
              var notice = $("[name='notice']").val();
              if(!notice){
                alert('理由不能为空');return false;
              }
              $.getJSON(url,{notice:notice,uid:uid,status:status},function(data){
                alert(data.info);                
                if(data.status){
                  $("#oper_" + uid).html('');
                  $("#status_" + uid).html('已拒绝');
                }
                return true;
              });              
            },
            focus: true
          }],          
        });

        var data = '<div style="overflow:hidden;padding: 5px; ">\
        <div class="table_full">\
          <table width="100%" class="table_form contentWrap">\
             <tbody>\
           <tr>\
           <th width="80">信息内容</td>\
           <td><textarea type="text" name="notice" cols="60" rows="3" style="height:50px;width:400px;">拒绝理由：</textarea></td>\
           </tr>\
           </tbody>\
           </table>\
        </div>\
        </div>';
        dialog.content(data);



      })
    })

    })
  </script>
</body>
</html>